package state.group.events;

import messages.ByteList;

public class DoorEvent extends ElevatorEvent {
    
    private byte isOpen;
    
    public DoorEvent(byte[] data, int startIndex)
    {
        super(data, startIndex);
        isOpen = data[startIndex + 2];
    }
    
    public DoorEvent(byte elevatorId, byte isOpen)
    {
        super(elevatorId);
        this.isOpen = isOpen;
    }
    
    public byte isOpen()
    {
        return isOpen;
    }

    @Override
    public int getEventByteLength()
    {
        return 3;
    }

    @Override
    public void appendToByteList(ByteList list)
    {
        super.appendToByteList(list);
        list.addByte(isOpen);
    }

    @Override
    public EventType getEventType()
    {
        return EventType.DoorEvent;
    }

}
